<link rel="stylesheet" href="<?php echo JS_PATH;?>/jquery/slideform/css/style.css" type="text/css" media="screen" />
<style>
    table tr .checkout {
        vertical-align:top;
    }
</style>
<div class="blockcms">
<div class="story" style="padding:10px">
    <div class="bg-repeat"></div>
    <?php
    $user = $this->user;
    ?>
    <form action="<?=BASE_URL?>/shop/checkoutprocess" method="post" id="form">
    <table width="100%" style="padding:20px">
        <tr class="checkout">
            <td>
    <table width="100%" style="padding:20px">
        <tr>
            <td>
                <div style="font-size:16px; padding:10px 0px">
                    <b><?=$this->translate->_('Billing Address')?></b>
                </div>
                <!--div style="padding:10px 0px;">
                    Please provide the shipping address below. If this is a gift, please provide the gift recipient's name. You can also specify a personal message.
                </div-->
                
            </td>
        </tr>
        <tr valign="top">
            <td width="100">
                <table width="100%" id="tableontop">
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('First Name')?></td>
                        <td><?=$this->formText('FirstName', $user->FirstName , array('style' => 'width:200px', 'class'=>'uniform mailling validate[required]'))?></td>
                    </tr>
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('Last Name')?></td>
                        <td><?=$this->formText('LastName', $user->LastName , array('style' => 'width:200px', 'class'=>'uniform mailling validate[required]'))?></td>
                    </tr>
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('Email')?></td>
                        <td><?=$this->formText('Email', $user->Email, array('style' => 'width:200px', 'class'=>'uniform mailling validate[required,custom[email]]'))?></td>
                    </tr>
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('Address')?></td>
                        <td><?=$this->formText('Address', $user->Street, array('style' => 'width:200px', 'class'=>'uniform mailling validate[required]'))?></td>
                    </tr>
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('City')?></td>
                        <td><?=$this->formText('City', $user->City, array('style' => 'width:200px', 'class'=>'uniform mailling validate[required]'))?></td>
                    </tr>
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('State')?></td>
                        <td><?=$this->formText('State', $user->State, array('style' => 'width:200px', 'class'=>'uniform mailling validate[required]'))?></td>
                    </tr>
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('Zip code')?></td>
                        <td><?=$this->formText('ZipCode', $user->Zip, array('style' => 'width:200px', 'class'=>'uniform mailling validate[required]'))?></td>
                    </tr>
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('Country')?></td>
                        <td>
                        <?php
                        //$this->formText('Country', $user->Country, array('style' => 'width:200px', 'class'=>'uniform mailling validate[required]'))
                        ?>
                                <select name="Country" id="Country" class="mailling combobox uniform validate[required]">
                                    <option value="">Country</option>
                                    <?php
                                        $rowcountry = $this->rowcountry;
                                        foreach ($rowcountry as $value) {
                                            ?>
                                                <option value="<?=$value['country_code']?>" <?php if($value['country_code'] == $user->Country){ echo "selected";}?>><?=$value['country_name']?></option>
                                            <?php
                                        }
                                    ?>
                                </select>
                        </td>
                    </tr>
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('Phone')?></td>
                        <td>
                            <?=$this->formText('Phone', $user->Phone, array('style' => 'width:200px', 'class'=>'uniform mailling validate[required,custom[number]] '))?>
                            <div style="padding:10px"></div>
                        </td>
                    </tr>
                    <!--tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('Mobile phone')?></td>
                        <td><?=$this->formText('Mobile', $user->Phone2, array('style' => 'width:200px', 'class'=>'uniform mailling validate[required,custom[number]]'))?></td>
                    </tr>
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('Email')?></td>
                        <td><?=$this->formText('Email', $user->Email, array('style' => 'width:200px', 'class'=>'uniform mailling validate[required,custom[email]]'))?></td>
                    </tr-->
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('Company')?></td>
                        <td><?=$this->formText('Company', $user->Company, array('style' => 'width:200px', 'class'=>'uniform mailling validate[required]'))?></td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
            </td>
            <td>
    <table width="100%" style="padding:20px">
        <tr>
            <td>
                <div style="font-size:16px; padding:10px 0px">
                    <b><?=$this->translate->_('Shipping Address')?></b>
                </div>
                <div style="padding:10px 0px;">
                    <input type="checkbox" id="thesamemailling"/>
                    This will be shipped to the same address.
                </div>
                
            </td>
        </tr>
        <tr valign="top">
            <td width="100">
                <table width="100%" id="tableontop">
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('Address')?></td>
                        <td><?=$this->formText('AddressBilling', $this->customerAddress, array('style' => 'width:200px', 'class'=>'uniform billing validate[required]'))?></td>
                    </tr>
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('City')?></td>
                        <td><?=$this->formText('CityBilling', $this->customerCity, array('style' => 'width:200px', 'class'=>'uniform billing validate[required]'))?></td>
                    </tr>
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('State')?></td>
                        <td><?=$this->formText('StateBilling', $this->customerState, array('style' => 'width:200px', 'class'=>'uniform billing validate[required]'))?></td>
                    </tr>
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('Zip code')?></td>
                        <td><?=$this->formText('ZipCodeBilling', $this->customerZipCode, array('style' => 'width:200px', 'class'=>'uniform billing validate[required]'))?></td>
                    </tr>
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('Country')?></td>
                        <td>
                        <?php
                        //$this->formText('CountryBilling', $this->customerCountry, array('style' => 'width:200px', 'class'=>'uniform billing validate[required]'))
                        ?>
                                <select name="CountryBilling" id="CountryBilling" class="combobox validate[required]" style="width:200px">
                                    <option value="">Country</option>
                                    <?php
                                        $rowcountry = $this->rowcountry;
                                        foreach ($rowcountry as $value) {
                                            ?>
                                                <option value="<?=$value['country_code']?>"><?=$value['country_name']?></option>
                                            <?php
                                        }
                                    ?>
                                </select>
                        </td>
                    </tr>
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('Phone')?></td>
                        <td>
                            <?=$this->formText('PhoneBilling', $this->customerPhone, array('style' => 'width:200px', 'class'=>'uniform billing validate[required,custom[number]]'))?>
                            <div style="padding:10px"></div>
                        </td>
                    </tr>
                    <!--tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('Mobile phone')?></td>
                        <td><?=$this->formText('MobileBilling', $this->customerMobile, array('style' => 'width:200px', 'class'=>'uniform billing validate[required,custom[number]]'))?></td>
                    </tr>
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('Email')?></td>
                        <td><?=$this->formText('EmailBilling', $this->customerEmail, array('style' => 'width:200px', 'class'=>'uniform billing validate[required,custom[email]]'))?></td>
                    </tr-->
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('First Name')?></td>
                        <td><?=$this->formText('FirstNameBilling', $this->FirstNameBilling, array('style' => 'width:200px', 'class'=>'uniform billing validate[required]'))?></td>
                    </tr>
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('Last Name')?></td>
                        <td><?=$this->formText('LastNameBilling', $this->LastNameBilling, array('style' => 'width:200px', 'class'=>'uniform billing validate[required]'))?></td>
                    </tr>
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('Email')?></td>
                        <td><?=$this->formText('EmailBilling', $this->EmailBilling, array('style' => 'width:200px', 'class'=>'uniform mailling validate[required,custom[email]]'))?></td>
                    </tr>
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('Company')?></td>
                        <td><?=$this->formText('CompanyBilling', $this->CompanyBilling, array('style' => 'width:200px', 'class'=>'uniform billing validate[required]'))?></td>
                    </tr>
                    <tr style="height:28px">
                        <td style="width:80px;"><?=$this->translate->_('Message')?></td>
                        <td><?=$this->formText('MessageBilling', $this->MessageBilling, array('style' => 'width:200px', 'class'=>'uniform billing'))?></td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <div>
                    <input type="checkbox" value="1" name="giftWrapEnabled" class="uniform"/>
                    For an additional $0.00 we can gift wrap your package.
                </div>

                <div class="bg-repeat"></div>
                <div style="padding:20px 0px;">
                    <div>
                        <input type="submit" value="Continue Checkout" class="uniform">
                        <input type="reset" value="Clear" class="uniform">
                    </div>
                </div>
            </td>
        </tr>
    </table>
    </form>
</div>



</div>

    <script src="<?php  echo JS_PATH?>/jquery/ValidationEngine/js/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"></script>
    <script src="<?php  echo JS_PATH?>/jquery/ValidationEngine/js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
        <link rel="stylesheet" href="<?php  echo JS_PATH?>/jquery/ValidationEngine/css/validationEngine.jquery.css" type="text/css"/>
        <script>
            $(document).ready(function(){
                // binds form submission and fields to the validation engine
                $("#form").validationEngine('attach');
            });
        </script>


<!--script src="<?=JS_PATH?>/jquery/validate/jquery.validate.js" type="text/javascript"></script-->

<script type="text/javascript">
    $(document).ready(function(){ 
        //jQuery("#form").validate();
        $(".muiten").click(function(){
            jQuery("#form").submit();
        });
        $("#thesamemailling").change(function(){
            //var val = ;
            if ($(this).is(':checked')) {
                updateBilling();
            }
        });
        $('.mailling').blur(function(){
            if($("#thesamemailling").is(':checked')) {
                updateBilling();
            }
        });
    });
    
    function updateBilling() {
        $('.mailling').each(function(){
            var id = $(this).attr('id');
            $('#' + id + 'Billing').val($(this).val());
        });
    }

</script>
<style>
    #tableontop tr{
        vertical-align:top;
    }
</style>